package com.k7k7.sserver.client;

import com.k7k7.util.ElementUtil;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;

/**
 * User: Administrator
 * Date: 2009-4-27
 * Time: 15:29:30
 */
public class UserOpt extends Opt {
	private ClientS client;

	public UserOpt(ClientS client) {
		super();
		this.client = client;
	}

	public void getbaseinfo(Element cmd) {
		ElementUtil.removeAllChild(cmd);
		getInfo(cmd);
		this.client.send(cmd);
	}

	public Element getWear(Element cmd) {
		cmd.add(DocumentHelper.createElement("hat").addText(this.client.user.getUserWear().getHat()));
		cmd.add(DocumentHelper.createElement("clothing").addText(this.client.user.getUserWear().getClothing()));
		cmd.add(DocumentHelper.createElement("shoes").addText(this.client.user.getUserWear().getShoes()));
		return cmd;
	}

	public Element getInfo(Element cmd) {
		cmd.add(DocumentHelper.createElement("appearance").addText(this.client.user.getUserBase().getAppearance().toString()));
		cmd.add(DocumentHelper.createElement("nick").addText(this.client.user.getUserBase().getNick()));
		cmd.add(DocumentHelper.createElement("age").addText(this.client.user.getUserBase().getAge().toString()));
		cmd.add(DocumentHelper.createElement("sex").addText(this.client.user.getUserBase().isSex().toString()));
		cmd.add(DocumentHelper.createElement("lastscene").addText(this.client.user.getUserBase().getLastScene()));
		return cmd;
	}
}
